<?
//---------------------------------------------------------------------------------
function get_clients_details($rid){
        global $session_db_name, $dbh;
        $SQL="select s.client,s.date,t.domain,t.email from temporary_signup t,sales s where t.username=s.client and signup_state='signup_ok' and t.reseller_id='$rid' GROUP BY s.client";
        if (!($result = mysql_db_query($session_db_name,$SQL, $dbh))) return 0;
        while($row=mysql_fetch_array($result)){
		$res[] =  $row;
        }
        return $res;
}
//---------------------------------------------------------------------------------
?>
<TABLE border=1 class='bTable' cellspacing='0'>
<tr><th>#</th><th>Username</th><th>E-mail</th><th>Domain</th><th>Date</th>
<?
$data = get_clients_details($id);
if(is_array($data)) foreach($data as $d){
	$count++;
	echo "<tr><td>$count</td><td>$d[client]</td><td>$d[email]</td><td>$d[domain]</td><td>$d[date]</td></tr>";
}
?>
</table>